<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin:0;
            padding:0;
        }
        #box{
            height:100px;
            width:100px;
            border:5px solid red;
            overflow: auto;
        }
    </style>
</head>
<body>
    <div id="box" style="background-color: pink;color:green;">
        111
    </div>
   <script>
    //获取
    //ele.style.XXX  只能获取行内样式，内嵌和外链的样式都获取不到
       console.log(box.style.color);
       console.log(box.style.width);
       console.log(box.style.backgroundColor);
       console.log(box.style.height);

    //获取样式---行内、内嵌和外链都可以获取
    // getComputedStyle(ele)["XXX"]
       console.log(getComputedStyle(box).color);
       console.log(window.getComputedStyle(box)["width"]);
    //IE 没有被淘汰的时候，有兼容IE的---行内、内嵌和外链都可以获取
    //console.log(box.currentStyle.color);//IE6-8

    //设置（1）---行内
       box.style.fontSize="50px";
   </script>
</body>
</html>